package com.tiantai.dashboard.service.impl;

import java.util.List;
import com.tiantai.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.tiantai.dashboard.mapper.TeaHistoryMapper;
import com.tiantai.dashboard.domain.TeaHistory;
import com.tiantai.dashboard.service.ITeaHistoryService;

import static com.tiantai.common.utils.SecurityUtils.getUsername;

/**
 * 历史管理Service业务层处理
 * 
 * @author handsomedog
 * @date 2024-07-25
 */
@Service
public class TeaHistoryServiceImpl implements ITeaHistoryService 
{
    @Autowired
    private TeaHistoryMapper teaHistoryMapper;

    /**
     * 查询历史管理
     * 
     * @param id 历史管理主键
     * @return 历史管理
     */
    @Override
    public TeaHistory selectTeaHistoryById(Long id)
    {
        return teaHistoryMapper.selectTeaHistoryById(id);
    }

    /**
     * 查询历史管理列表
     * 
     * @param teaHistory 历史管理
     * @return 历史管理
     */
    @Override
    public List<TeaHistory> selectTeaHistoryList(TeaHistory teaHistory)
    {
        return teaHistoryMapper.selectTeaHistoryList(teaHistory);
    }

    /**
     * 新增历史管理
     * 
     * @param teaHistory 历史管理
     * @return 结果
     */
    @Override
    public int insertTeaHistory(TeaHistory teaHistory)
    {
        teaHistory.setCreateBy(getUsername());
        teaHistory.setCreateTime(DateUtils.getNowDate());
        return teaHistoryMapper.insertTeaHistory(teaHistory);
    }

    /**
     * 修改历史管理
     * 
     * @param teaHistory 历史管理
     * @return 结果
     */
    @Override
    public int updateTeaHistory(TeaHistory teaHistory)
    {
        teaHistory.setUpdateBy(getUsername());
        teaHistory.setUpdateTime(DateUtils.getNowDate());
        return teaHistoryMapper.updateTeaHistory(teaHistory);
    }

    /**
     * 批量删除历史管理
     * 
     * @param ids 需要删除的历史管理主键
     * @return 结果
     */
    @Override
    public int deleteTeaHistoryByIds(Long[] ids)
    {
        return teaHistoryMapper.deleteTeaHistoryByIds(ids);
    }

    /**
     * 删除历史管理信息
     * 
     * @param id 历史管理主键
     * @return 结果
     */
    @Override
    public int deleteTeaHistoryById(Long id)
    {
        return teaHistoryMapper.deleteTeaHistoryById(id);
    }
}
